
#ifndef GEOSPHERE_H
#define GEOSPHERE_H

#include <list>
#include <iostream>
#include "GeosphereFace.h"
#include "GeosphereVert.h"

using namespace std;

class Geosphere {

	public:

		Geosphere(float r, int l);
		void draw(int detailLevels, Vec3f view);
		void buildTerrain();
		int getNumFaces();
		GeosphereFace* getFace(int index);

	private:	

		float radius;
		int maxLevels;
		int numFaces;
		GeosphereFace* faces;
		list<GeosphereFace*> allFaces;
		list<GeosphereVert*> allVerts;

		void buildDiamondBase();
		void buildCubeBase();
		inline void weldVerts(list<GeosphereFace*>::iterator& i, 
			list<GeosphereFace*>::iterator& j);

};

#endif
